﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Masters/WithoutPermBasic.Master" AutoEventWireup="true" CodeBehind="PC_UnInviteOrder.aspx.cs" Inherits="PMS.WaitDealUI.PC_UnInviteOrder" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        $(function () {
            var DealId = com.get.DealId;
            $("#tbList").datagrid({
                url: '/Logic/CommonAjax/WaitDealAjax.aspx?method=CommonWaitDealList',
                loadMsg: '数据加载中请稍后……',
                fitColumns: true,
                rownumbers: true,
                idField: "ID",
                singleSelect: false,
                queryParams: { DealId: DealId },
                striped: true,
                frozenColumns: [[{ field: 'ck', checkbox: true, width: 30 },
                  { field: 'PlanBatchId', title: '（技术）计划批号 ', align: "center" },
                  { field: 'PlanTrackId', title: '计划跟踪号 ', align: "center" },
                  { field: 'Tuhao', title: '图号/标识号 ', align: "center" },
                  { field: 'MaterialCode', title: '物料编码 ', align: "center" },
                  { field: 'MaterialName', title: '物料名称 ', align: "center" }, ]],
                columns: [[
                 { field: 'MaterialGuige', title: '规格 ', align: "center" },
                 { field: 'MaterialCaizhi', title: '材质 ', align: "center" },
                 { field: 'MaterialGB', title: '国标 ', align: "center" },
                 { field: 'SupplierName', title: '供货商名称 ', align: "center" },
                 { field: 'Price', title: '价格 ', align: "center" },
                 { field: 'DemandNum', title: '采购计划数量 ', align: "center" },
                 { field: 'PurcUnit', title: '采购单位 ', align: "center" },
                 { field: 'PurchaseName', title: '采购员 ', align: "center" },
                  { field: 'ExecutorNum', title: '执行数量', align: "center" },
                  { field: 'MaterialType', title: '类型 ', align: "center" },
                { field: 'ExecutorName', title: '执行人', align: "center" },
               { field: 'ExecutorDate', title: '执行日期', align: "center" },
                {
                    field: 'State', title: '状态 ', align: "center", formatter: function (value, row, Index) {
                        return com.getArrayText(StaticCombo.PcDemandPlanState, value);
                    }
                },
               { field: 'Note', title: '备注 ', align: "center" }]],
            });
        });
        //生产采购订单
        function funcMakeBill() {
            var rows = $("#tbList").datagrid("getSelections");
            var n = 0;
            var supplyname = new Array();
            if (rows.length != 0) {
                var oId = { compareInfo: JSON.stringify(rows) };
                for (var j = 0; j < rows.length; j++) {
                    if (rows[0].SupplierName != rows[j].SupplierName) {
                        com.message("error", "存在不一样的供应商，请重新选择");
                        return;
                    }
                }
                for (var j = 0; j < rows.length; j++) {
                    if (rows[j].State == '7') {
                        com.message("error", "存在已下推比价单");
                        return;
                    }
                }
                com.ajax({
                    url: "/Logic/PC/PC_OrderAjax.aspx?method=insertOrder2",
                    data: oId,
                    success: function (data) {
                        if (data.state == "success") {
                            console.log(data.orderId);
                            top.wrapper.addTab("下推采购订单", "/UI/PC/PC_Order.aspx?OrderId=" + data.orderId);
                        }
                    }
                });
            }
            else {
                com.message("information", "请至少选中一行");
            }
        }
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceToorbar" runat="server">
    <a href="javascript:void(0)" id="compare" class="easyui-linkbutton" onclick="funcDivide()"
        data-options="iconCls:'icon-settings32',plain:true">下推订单</a> &nbsp;&nbsp;
    
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <table id="tbList" title="招标--订单" style="width: 100%">
        </table>
</asp:Content>
